﻿@using TomNet.IMSC.Model.DbModels.Organization;
@{
    Layout = null;
    var entityRole = ViewBag.entityRole as List<StaffRoles>;
    var RoleList = ViewBag.RoleList as SelectList;
    var ID = ViewBag.id;

}
<!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">


    <title>H+ 后台主题UI框架 - 选项卡 &amp; 面板</title>

    <link rel="shortcut icon" href="favicon.ico">
    <link href="~/Content/Css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="~/Content/Css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link href="~/Content/Css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="~/Content/Css/animate.css" rel="stylesheet">
    <link href="~/Content/Css/style.css?v=4.1.0" rel="stylesheet">
    <style>
        label {
            width: 215px;
        }

        .i-checks {
            height: 455px;
        }
        /*.col-sm-1, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6, .col-sm-7, .col-sm-8, .col-sm-9, .col-sm-10, .col-sm-11, .col-sm-12 ,
        .col-xs-1, .col-xs-2, .col-xs-3, .col-xs-4, .col-xs-5, .col-xs-6, .col-xs-7, .col-xs-8, .col-xs-9, .col-xs-10, .col-xs-11, .col-xs-12,
        .btn-group {
            border-style: solid;
            border-width: 1px;
            border-color: #000;
        }*/
        #MaxDiv {
            margin-bottom: 0px;
        }
    </style>
</head>

<body class="gray-bg">
    <div class="wrapper wrapper-content animated fadeIn" id="MaxDiv">
        <div class="row">
            <div class="col-sm-12">
                <form class="form-horizontal m-t" id="mainForm">
                      
                    <input type="hidden" id="Id" name="Id" value="@ID" />

                    <div class="tabs-container">
                        <div class="tabs-left">
                            <ul class="nav nav-tabs">
                                <li class="active">
                                    <a data-toggle="tab" href="#tab-1">角色设置</a>
                                </li> 
                            </ul>
                            <div class="tab-content">
                                <div id="tab-1" class="tab-pane active">
                                    <div class="panel-body">
                                        <div class="col-sm-12">
                                            <div class="i-checks">
                                                @foreach (SelectListItem item in RoleList.Items)
                                                {
                                                    if (entityRole.Where(a => a.RoleID == Convert.ToInt32(item.Value)).ToList().Count() > 0)
                                                    {
                                                        <label class="checkbox-inline">
                                                            <input type="checkbox" value="@item.Value" name="RoleID" checked>@item.Text
                                                        </label>
                                                    }
                                                    else
                                                    {
                                                        <label class="checkbox-inline">
                                                            <input type="checkbox" value="@item.Value" name="RoleID">@item.Text
                                                        </label>
                                                    }
                                                }
                                            </div>
                                        </div>
                                    </div>
                                </div>

                                <div class="form-group Submit" style="padding-right:15px;margin-top:15px;">
                                    <button id="submit" class="btn btn-primary pull-right" type="submit">
                                        <i class="fa fa-check"></i>&nbsp;提&nbsp;交
                                    </button>
                                </div>
                            </div>



                        </div>

                    </div>
                </form>
            </div>
        </div>

    </div>


    <!-- 全局js -->
    <script src="~/Scripts/jquery.min.js?v=2.1.4"></script>
    <script src="~/Scripts/bootstrap.min.js?v=3.3.6"></script>
    <!-- jQuery Validation plugin javascript-->
    <script type="text/javascript" src="~/Scripts/plugins/validate/jquery.validate.min.js"></script>
    <script type="text/javascript" src="~/Scripts/plugins/validate/messages_zh.min.js"></script>
    <script type="text/javascript" src="~/Scripts/Extensions/ExtValidator.js"></script>
    <!-- layer javascript -->
    <script type="text/javascript" src="~/Scripts/plugins/layer/layer.min.js"></script>

    <!-- 自定义js -->
    <script src="~/Scripts/content.js?v=1.0.0"></script>
    <!-- iCheck -->
    <script src="~/Scripts/plugins/iCheck/icheck.min.js"></script>


    <script type="text/javascript" src="http://tajs.qq.com/stats?sId=9051096" charset="UTF-8"></script>
    <!--统计代码，可删除-->
    <script type="text/javascript">
        $(function () {
            $('.i-checks').iCheck({
                checkboxClass: 'icheckbox_square-green',
                radioClass: 'iradio_square-green',
            }); 



            var icon = "<i class='fa fa-times-circle'></i> ";
            var validator = $("#mainForm").validate({
                rules: {
                },
                messages: {
                },
                submitHandler: function (form) {
                    //进行ajax传值
                    $.ajax({
                        url: "/organization/staff/EditRoleAsync",
                        type: "post",
                        dataType: "json",
                        data: $('#mainForm').serialize(),
                        success: function (data) {
                            //Info,Success,Warning,Error
                            var type = data.type;
                            if (type == 1) {
                                layer.msg(data.content, { icon: 6, time: 2000 },
                                    function () {
                                        var index = parent.layer.getFrameIndex(window.name);
                                        parent.layer.close(index);
                                    });

                            } else {
                                layer.msg(data.content, { icon: 5, time: 2000 });
                            }
                        }
                    });
                }
            });
        }); 
    </script>
</body>

</html>
